package com.to.aboomy.bannersample.util;

import com.to.aboomy.bannersample.ResourceTable;

import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;

/**
 * auth aboom
 * date 2019-12-26
 */
public class Utils {
    /**
     * PARAMETER_KEY
     */
    public static final String PARAMETER_KEY = "parameter_key";

    private static final int[] IMAGES = {
            ResourceTable.Media_image1,
            ResourceTable.Media_image2,
            ResourceTable.Media_image3,
            ResourceTable.Media_image4,
            ResourceTable.Media_image5,
    };

    /**
     * getImage
     *
     * @param count count
     * @return List
     */
    public static List<Integer> getImage(int count) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < count; i++) {
            list.add(IMAGES[i]);
        }
        return list;
    }

    /**
     * getRandomImage
     *
     * @return int
     */
    public static int getRandomImage() {
        return IMAGES[new SecureRandom().nextInt(IMAGES.length)];
    }

    /**
     * -----------------------------------------------------------------------
     */

    private static final int[] URLS = {
           ResourceTable.Media_image11,
            ResourceTable.Media_image12,
            ResourceTable.Media_image13,
            ResourceTable.Media_image14,
            ResourceTable.Media_image15,
            ResourceTable.Media_image16,
            ResourceTable.Media_image17,
            ResourceTable.Media_image18,
            ResourceTable.Media_image19
    };

    /**
     * 获取随机数
     *
     * @return int
     */
    public static int getRandom() {
        return URLS[new SecureRandom().nextInt(URLS.length)];
    }

    /**
     * getData
     *
     * @param size
     * @return List
     */
    public static List<Integer> getData(int size) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            list.add(getRandom());
        }
        return list;
    }
}
